package com.zl.task.util.resp;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author YinlinGeng
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Getter
@Setter
@ToString
public class RequestData<T> implements Serializable {
    private static final long serialVersionUID = 6287447161526075181L;

    //web应用或手机应用区分  1:web 2:app
    @ApiModelProperty(value = "访问方式( 1 2 3")
    private String appWebFlag;

    @ApiModelProperty(value = "来源系统")
    private String sysId;

    // 页面的请求数据
    @ApiModelProperty(value = "业务参数", name = "reqData")
    private T reqData;

    @ApiModelProperty(value = "请求时间", hidden = true)
    private long reqTime = System.currentTimeMillis();

    public RequestData() {
    }

    public RequestData(T reqData) {
        this.reqData = reqData;
    }

    public RequestData(String appWebFlag, T reqData) {
        this.appWebFlag = appWebFlag;
        this.reqData = reqData;
    }

    public RequestData(String appWebFlag, String sysId, T reqData) {
        this.appWebFlag = appWebFlag;
        this.sysId = sysId;
        this.reqData = reqData;
    }

    public RequestData(String appWebFlag, String sysId, T reqData, long reqTime) {
        this.appWebFlag = appWebFlag;
        this.sysId = sysId;
        this.reqData = reqData;
        this.reqTime = reqTime;
    }
}